package com.ghl.crawler;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class TestThread {


    public static void main(String[] args) {

        ExecutorService executorService = Executors.newFixedThreadPool(10);

        for (int i = 0; i < 10; i++) {

            final int a = i;
            executorService.execute(new Runnable() {
                @Override
                public void run() {
                    try {
                        Thread.sleep(200);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                    System.out.println(Thread.currentThread().getName() + ":" + a);
                }
            });

        }
        executorService.shutdown();


    }


}
